home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / applications / wp / macro28.lha / Macro / FinsGold / GetXRef.ged < prev    next >
Encoding:
Text File  |  1994-04-06  |  3.6 KB  |  148 lines

  1. /** $VER: GetXRef.ged 0.9 (6. Apr. '94)
  2.  **
  3.  ** Written by Fin Schuppenhauer
  4.  **
  5.  ** Display the hypertext Autodoc page for the word currently under
  6.  ** the cursor.
  7.  ** Based on the script "getxref.ttx" (V2.0) by David N. Junod.
  8.  **
  9.  **                                 ***
  10.  **
  11.  ** Zeigt die Hypertext-Autodoc-Seite für das Wort unter dem Cursor
  12.  ** an.
  13.  ** Dieses Skript basiert auf dem Skript "getxref.ttx" (V2.0) von
  14.  ** David N. Junod.
  15.  **
  16.  **
  17.  ** My address:
  18.  **
  19.  **   Fin Schuppenhauer
  20.  **   Brausspark 10
  21.  **   D-20537 Hamburg
  22.  **   (Germany)
  23.  **
  24.  ** E-Mail: schuppen@rzdspc2.informatik.uni-hamburg.de
  25.  **
  26.  ** This script is FREEWARE.
  27.  **
  28.  ** Thanks to:
  29.  **   Dietmar Eilert for his GoldED
  30.  **   David N. Junod
  31.  **/
  32.  
  33. OPTIONS RESULTS                             /* enable return codes     */
  34.  
  35. if (LEFT(ADDRESS(), 6) ~= "GOLDED") then    /* not started by GoldEd ? */
  36.     address 'GOLDED.1'
  37.  
  38. 'LOCK CURRENT'                              /* lock GUI, gain access   */
  39. OPTIONS FAILAT 6                            /* ignore warnings         */
  40. SIGNAL ON SYNTAX                            /* ensure clean exit       */
  41.  
  42.  
  43. /* ------------------------ INSERT YOUR CODE HERE: ------------------- */
  44.  
  45.  
  46. 'QUERY CAT'
  47. isGerman = (result = "deutsch")
  48.  
  49. /* amigaguide.library öffnen (falls dies noch nicht geschehen ist): */
  50. if ~show('L','amigaguide.library') then
  51.    if ~addlib('amigaguide.library',0,-30) then do
  52.       if isGerman then
  53.          'REQUEST BODY="Keine amigaguide.library vorhanden!" BUTTON=Abbrechen'
  54.       else
  55.          'REQUEST BODY="amigaguide.library not available!" BUTTON=Cancel'
  56.       'UNLOCK'
  57.       EXIT
  58.    end
  59.  
  60. /* Wort unter dem Cursor ermitteln: */
  61. 'QUERY WORD VAR WORT'
  62.  
  63. if isGerman then
  64.    'REQUEST BODY="Informationen laden für:" OLD='wort' STRING VAR=WORT'
  65. else
  66.    'REQUEST BODY="Loading information for:" OLD='wort' STRING VAR=WORT'
  67. if rc ~= 0 then do
  68.    'UNLOCK'
  69.    EXIT
  70. end
  71.  
  72. /* Autodoc cross-reference table laden, wenn noch nicht vorhanden: */
  73. line = GetXRef("OpenWindow()")
  74. if line = 10 then do
  75.    if isGerman then
  76.       'REQUEST STATUS="Lade Cross-Reference Datei ..."'
  77.    else
  78.       'REQUEST STATUS="Loading cross-reference file ..."'
  79.    LoadXRef(autodocs.xref)
  80. end
  81.  
  82. /* Gibt es das Wort in der cross-reference-table? */
  83. function = wort
  84. xref = 0
  85. line = GetXRef(function)
  86. if line = 10 then do
  87.    /* Klammern an den Namen anhängen: */
  88.    function = wort || "()"
  89.  
  90.    /* Nochmal versuchen: */
  91.    line = GetXRef(function)
  92.    if line = 10 then do
  93.       function = wort
  94.    end
  95.    else do
  96.       xref = 1
  97.    end
  98. end
  99. else
  100.    xref = 1
  101.  
  102. if isGerman then
  103.    'REQUEST STATUS="Lade ' || function || ' ..."'
  104. else
  105.    'REQUEST STATUS="Loading '||function||' ..."'
  106.  
  107. /* Haben wir schon ein Autodoc-Fenster geöffnet? */
  108. if ~show('P','AUTODOCS') then do
  109.    if xref = 0 then
  110.       cmd = "run >NIL: AmigaGuide " || function || " portname AUTODOCS pubscreen GOLDED.1 requester"
  111.    else
  112.       cmd = "run >NIL: AmigaGuide document " || function || " portname AUTODOCS pubscreen GOLDED.1 requester"
  113.  
  114.    ADDRESS COMMAND cmd
  115. end
  116. else do
  117.    link = "Link"
  118.  
  119.    if xref = 0 then
  120.       cmd = link || " " || function || "/main"
  121.    else
  122.       cmd = link || " " || function
  123.  
  124.    OPTIONS FAILAT 21
  125.    ADDRESS AUTODOCS cmd
  126.    if rc = 20 then
  127.       if isGerman then
  128.          'REQUEST BODY="Keine Information für|'''function''' vorhanden." BUTTON=Ok'
  129.       else
  130.          'REQUEST BODY="No information for|'''function''' available." BUTTON=Ok'
  131.    else
  132.       ADDRESS AUTODOCS "windowtofront"
  133. end
  134.  
  135.  
  136. /* ---------------------------- END OF YOUR CODE --------------------- */
  137.  
  138. 'UNLOCK' /* VERY important: unlock GUI */
  139. EXIT
  140.  
  141. SYNTAX:
  142.  
  143. SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
  144. 'UNLOCK'
  145. EXIT
  146.  
  147.  
  148.